package com.studyadmin.controller;

import com.studyadmin.service.CommonService;
import com.studyadmin.util.JsonUtil;
import com.studyadmin.dto.RegParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @Author lyl
 * @Date 2023/3/3 19:08
 * @Description 用于邮箱的注册
 * 发送请求 回传授权码，邮箱发送验证码
 * @Version 1.0
 */


@RestController
@RequestMapping("/springboot_my_wms/common")
@CrossOrigin
public class CommonController {

    @Autowired
    private CommonService commonService;

    // 权限码请求接口
    @PostMapping("/request")
    public JsonUtil getRequestPermissionCode(@RequestBody String emailJson) {
        System.out.println(emailJson);
        return commonService.getRequestPermissionCode(emailJson);
    }

    // 邮箱验证码接口
    @PostMapping("/email")
    public JsonUtil sendEmailCode(@RequestBody RegParam loginParam) {
        return commonService.sendEmailCode(loginParam);
    }
}
